<template>
  <div class="task">
    <van-nav-bar placeholder title="任务详情" fixed left-arrow @click-left="back">
      <template #right>
        <img src="@/assets/images/ph.png" style="width: 24px; height: 24px" />
      </template>
    </van-nav-bar>
    <div class="task__swipe">
      <img src="@/assets/images/login.png" />
    </div>
    <div class="task__content" @click="toDetail">
      <div class="task__title">新员工培训计划</div>
      <div class="task__desc">
        任务描述任务描述任务描述任务描述任务描述任务描述
        任务描述任务描述任务描述
      </div>
      <div class="task__desc">
        <label>任务奖励</label>
        <div class="task__money"><span>50</span>金币 <span>200</span>经验</div>
      </div>
    </div>
    <div class="task__msg">
      <div class="task__msg-title">关联任务</div>
      <div class="task__cards">
        <div class="card" v-for="i in 3" :key="i">
          <img src="@/assets/images/login.png" />
          <div class="card__right">
            <div class="card__header">课程关联试卷</div>
            <div class="task__desc">
              <div class="task__money">
                <span>50</span>金币 <span>200</span>经验
              </div>
            </div>
            <div class="card__footer">
              <label>已报名12人</label>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script name="StudyDetail" setup>
import { useRouter } from "vue-router";
const router = useRouter();
const back = () => {
  window.history.back();
};
const toDetail = () => {
  router.push({
    path: "/course-detail",
  });
};
</script>
<style lang="scss" scoped>
.task {
  &__swipe {
    position: relative;
    height: 207px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  &__content {
    padding: 12px 16px;
    background-color: #fff;
  }
  &__title {
    font-size: 18px;
    font-family: PingFangSC, PingFang SC;
    font-weight: 600;
    color: #1e1e28;
    line-height: 25px;
  }

  &__desc {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    color: #2f3444;
    line-height: 20px;
    margin-top: 10px;
    label {
      margin-right: 8px;
    }
    span {
      color: #ffac24;
    }
  }
  &__msg {
    padding: 22px 16px;
    &-title {
      font-size: 18px;
      font-family: PingFangSC, PingFang SC;
      font-weight: 500;
      color: #171a1d;
      margin-bottom: 10px;
    }
  }

  &__cards {
    .card {
      display: flex;
      padding: 14px 16px;
      background-color: #fff;
      border-radius: 4px;
      margin-bottom: 12px;
      img {
        width: 110px;
        height: 80px;
        background: #d8d8d8;
        border-radius: 4px;
      }
      &__right {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding-left: 12px;
        flex: 1;
      }
      &__header {
        display: flex;
        align-items: center;
        span {
          padding: 2px 4px;
          background: #d8f3e5;
          border-radius: 2px;
          font-size: 12px;
          font-family: PingFangSC, PingFang SC;
          font-weight: 400;
          color: #00ad6f;
          line-height: 1;
          float: left;
          margin-right: 8px;
        }
        font-size: 16px;
        font-family: PingFangSC, PingFang SC;
        font-weight: 500;
        color: #272b2d;
        line-height: 22px;
      }
      &__footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        label {
          font-size: 12px;
          font-family: PingFangSC, PingFang SC;
          font-weight: 400;
          color: #b9bdbd;
        }
      }
      &__btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 60px;
        height: 20px;
        background: #b9bdbd;
        border-radius: 16px;
        font-size: 12px;
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        color: #ffffff;
        line-height: 17px;
        &.no-comp {
          background-color: #fff;
          border: 1px solid #00c37d;
          color: #00ad6f;
        }
      }
    }
  }
  &__by {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    color: #b9bdbd;
    line-height: 17px;
    span {
      padding: 0 8px;
      font-size: 24px;
    }
  }
}
</style>
